-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template (and forms) engine overhaul #443
Conversation
@xylo04 - Sorry about the messy PR. I don't expect you to do a full code review of all these changes If you (or anyone else) have time to do some testing, that would be much appreciated. Testing various Standard Forms templates. Send and receive Form based messages, use the reply templates etc. We need to verify that we're still compatible with Winlink Express, and that we haven't broken any of the (most popular) templates. It would probably be a good idea to invite others to test this as well, but I think we might need to facilitate with some pre-built binaries. If you have some time - Any help would be appreciated 😊 Thanks! |
Variable substitution is essentially the same as tag insertion, so the two features can share the same underlying implementation.
(HTML) Forms is an extension of the Templates feature in RMS Express. Templates are the .txt files. Some templates support HTML forms, indicated by the Template Control Field `Form`.
Forms-enabled templates is not written with a CLI user in mind. By echoing the template line before prompting for a <Var ...>, it will hopefully be possible to understand the meaning of the variable (by context). Also apply a hack to refresh the regular expressions used by varReplacer, to avoid prompting for the same variable multiple times.
<Day>, <UDay>, <GPSLatitude> and <GPSLongitude>
Also fixed issue of inconsistent output due to unstable ordering of form variables.
This fixes an issue where, when searching for a html viewer, we ended up using a non-existent HTML file.
Some templates references HTML Forms and reply templates located in adjecent folders, without specifying a relative path. Examples of this can be found in `MAPPING-GIS FORMS`.
By referencing the template instead of the "initial_uri" (Forms composer), the backend is able to more precisely identify the correct HTML file for any given template. It also makes handling of reply templates much easier. In addition to a less complex implementation, this simplifies the API as we no longer need to supply the frontend with URIs for all HTML variants. We also get increased performance because of the simplified file search, and by not having to parse reply templates upfront. This also opens up the possibility of serving a specialized HTML-based composer for text-only templates in the future, without having to change the existing frontend.
`./make,bash web` for 8fcca1c.
Winlink Express does include this, and neither should we.
I found this difference when comparing against Winlink Express's output using the same Form template. Winlink Express trims trailing whitespace before writing the form variables as XML.
Gofmt did not agree with my zero-padded numeric constants.
a52d116
to
6270fb8
Compare
Rebased. |
I think it's time to move forward with this PR. I believe we have had some testers, and no issues have been reported so far 🙂 |
This is a continuation of the recent related PRs #436 and #438. It's is my most recent iteration with cleanup/refactoring of the Templates (aka "Forms") package to improve maintainability and improve on some some known bugs and limitation of the current implementation. Eventually I hope we're able to provide full support for text-only templates in the web gui (#375, #325) and support additional (custom) template directories (#374) as well as supporting even more insertion tags (#338).
There are some major changes here. In particular changes related to resolving referenced HTML Form files and reply templates, which has basically been re-written from scratch. These changes require more testing, so we might need to call for help @ pat-users. The tests I've done so far is looking very promising.
I was originally planning to do this as multiple incremental PRs, but eventually gave up rebasing the commits. Sorry about that.
Here's a rough summary of the changes: